/*
 * searchIn2DSortedArray.cpp
 *
 *  Created on: Aug 15, 2012
 *      Author: jh238d
 */

#include <iostream>
using namespace std;

#define N_MAX 100;

bool search_in_2d_sorted_array(int mat[][N_MAX], int target, int m, int n){
	int row = 0, col = n-1;
	if(target < mat[0][0]||target>mat[m-1][n-1])
		return false;
	while(row <= n-1 || col >=0){
		if(mat[row][col] > target)
			col--;
		else if(mat[row][col] < target)
			row++;
		else
			return true;
	}
	return false;
}



